const path = require('path')
module.exports = {
    chainWebpack: config => {
        const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
        types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
    },
    devServer: {
        open: true,     //配置自动启动浏览器
        overlay: {
            warnings: true,
            errors: true
        }
    },
    lintOnSave: false   // 是否使用eslint
}
function addStyleResource (rule) {
  rule
    .use('style-resource')
    .loader('style-resources-loader')
    .options({
      patterns: [
        // 需要全局导入的less
        path.resolve(__dirname, './src/assets/less/variables.less'),
        path.resolve(__dirname, './src/assets/less/mixins.less')
      ]
    })
}